package com.mimc.framework.base;

import com.mimc.common.constant.EventConstants;
import com.mimc.framework.core.RequestHandler;
import com.mimc.framework.interceptors.AdminJwtInterceptor;
//import com.wms.framework.interceptors.ApiJwtInterceptor;
import com.mimc.framework.interceptors.ApiJwtInterceptor;
import com.mimc.framework.interceptors.CrossInterceptor;
import com.mimc.framework.interceptors.ExceptionInterceptor;
import com.jfinal.config.Interceptors;
import com.jfinal.config.Routes;
import com.mimc.framework.utils.MinioUtil;
import io.jboot.Jboot;
import io.jboot.aop.jfinal.JfinalHandlers;
import io.jboot.core.listener.JbootAppListenerBase;

public class InfoAppListenerBase extends JbootAppListenerBase {
    @Override
    public void onRouteConfig(Routes routes) {
        super.onRouteConfig(routes);
        routes.setBaseViewPath("/view");
    }

    @Override
    public void onInterceptorConfig(Interceptors interceptors) {
        super.onInterceptorConfig(interceptors);

        interceptors.addGlobalActionInterceptor(new ExceptionInterceptor());
        interceptors.add(new CrossInterceptor());
        interceptors.add(new AdminJwtInterceptor());
        interceptors.add(new ApiJwtInterceptor());

    }

    @Override
    public void onHandlerConfig(JfinalHandlers handlers) {
        super.onHandlerConfig(handlers);
        handlers.add(new RequestHandler());
    }

    @Override
    public void onStart() {
        super.onStart();
        //new MinioUtil().init();
    }

    @Override
    public void onStartFinish() {
        super.onStartFinish();
        Jboot.sendEvent(EventConstants.LOADTRANSLATEEVENT,"");
    }
}
